package com.example.feign.feign;

import com.example.feign.entity.Type;
import com.example.feign.feign.fallback.TypeFallback;
import com.example.feign.util.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@FeignClient(value = "BASE-SERVICE",fallback = TypeFallback.class)
public interface TypeFeign {
    @RequestMapping(
            value = "/type/get",
            method = RequestMethod.GET,
            consumes = "application/json")
    public Response getType(
            @RequestParam(value = "page",required = false) Integer page,
            @RequestParam(value = "size",required = false) Integer size,
            @RequestParam Map map
    );

    @RequestMapping(
            value = "/type/getAll",
            method = RequestMethod.GET,
            consumes = "application/json")
    public Response getAllType();

    @RequestMapping(value = "/type/add",method = RequestMethod.POST)
    public Response addType(@RequestBody Type type);

    @RequestMapping(value = "/type/update",method = RequestMethod.PUT)
    public Response updateType(@RequestBody Type type);

    @RequestMapping(value = "/type/del",method = RequestMethod.PUT)
    public Response delType(@RequestParam(value = "typeId", required = true) String typeId);

}
